﻿/*
 * @author: wizardc
 */

using System;
using Dou.Clip;
using UnityEngine;
using Object = UnityEngine.Object;

namespace Demo.WorldMap
{
    /// <summary>
    /// 预制静态数据
    /// </summary>
    public class PrefabStaticRenderData : ScriptableObject
    {
        public PrefabStaticRenderRes[] res;
        public PrefabStaticRenderTree[] trees;
    }
    
    [Serializable]
    public class PrefabStaticRenderRes
    {
#if UNITY_EDITOR
        public Object prefab;
#endif
        public string prefabName;
        public Bounds bounds;
    }

    [Serializable]
    public class PrefabStaticRenderTree
    {
        public string name;
        public PrefabStaticRenderNode[] nodes;
        public Matrix4x4[] matrixes;
    }

    [Serializable]
    public struct PrefabStaticRenderNode
    {
        public int index;
        public int child1;
        public int child2;
        public Bounds bounds;
        public int resId;
        public int matrixId;
        public bool isLeaf => resId >= 0;
        [NonSerialized]
        public FrustumClippingType clippingType; // 上次检测的结果
    }
}
